TEXT ·_hsum_int32(SB), $0-32

	MOVD input+0(FP),   R0
	MOVD result+8(FP),  R1
	MOVD size+16(FP),   R2

  WORD $0xb900003f		// MOVW ZR, (R1)
  WORD $0xd342fc43		// LSR $2, R2, R3
  WORD $0x7100007f		// CMPW $0, R3
  WORD $0x5400036d		// BLE 27(PC)
  WORD $0x51000465		// SUBW $1, R3, R5
  WORD $0x91004007		// ADD $16, R0, R7
  WORD $0x2a0503e6		// MOVW R5, R6
  WORD $0x0f000401		// VMOVI $0, V1.S2
  WORD $0xaa0003e4		// MOVD R0, R4
  WORD $0x8b2650e5		// ADD R6.UXTW<<4, R7, R5
  WORD $0x3cc10480		// MOVD.P 16(R4), V0
  WORD $0x6e20d400		// VFADDP V0.S4, V0.S4, V0.S4
  WORD $0xeb0400bf		// CMP R4, R5
  WORD $0x6e20d400		// VFADDP V0.S4, V0.S4, V0.S4
  WORD $0x1e202821		// FADDS F0, F1, F1
  WORD $0xbd000021		// FMOVS F1, (R1)
  WORD $0x54ffff41		// BNE -6(PC)
  WORD $0x531e7463		// LSLW $2, R3, R3
  WORD $0x93407c63		// SXTW R3, R3
  WORD $0xeb03005f		// CMP R3, R2
  WORD $0x54000129		// BLS 9(PC)
  WORD $0x8b030803		// ADD R3<<2, R0, R3
  WORD $0x8b020800		// ADD R2<<2, R0, R0
  WORD $0xd503201f		// NOOP
  WORD $0xbc404460		// FMOVS.P 4(R3), F0
  WORD $0x1e202821		// FADDS F0, F1, F1
  WORD $0xeb03001f		// CMP R3, R0
  WORD $0xbd000021		// FMOVS F1, (R1)
  WORD $0x54ffff81		// BNE -4(PC)
  WORD $0xd65f03c0		// RET
  WORD $0x0f000401		// VMOVI $0, V1.S2
  WORD $0x17fffff2		// JMP -14(PC)

TEXT ·_hmax_int32(SB), $0-32

	MOVD input+0(FP),   R0
	MOVD result+8(FP),  R1
	MOVD size+16(FP),   R2

  WORD $0xbd400001		// FMOVS (R0), F1
  WORD $0xd342fc43		// LSR $2, R2, R3
  WORD $0x7100007f		// CMPW $0, R3
  WORD $0xbd000021		// FMOVS F1, (R1)
  WORD $0x5400020d		// BLE 16(PC)
  WORD $0x51000465		// SUBW $1, R3, R5
  WORD $0x91004007		// ADD $16, R0, R7
  WORD $0x2a0503e6		// MOVW R5, R6
  WORD $0xaa0003e4		// MOVD R0, R4
  WORD $0x8b2650e5		// ADD R6.UXTW<<4, R7, R5
  WORD $0x3dc00080		// MOVD (R4), V0
  WORD $0x91004084		// ADD $16, R4, R4
  WORD $0xbd400021		// FMOVS (R1), F1
  WORD $0x6eb0f800		// FMINV V0.S4, F0
  WORD $0x1e202030		// FCMPES F0, F1
  WORD $0x54000065		// BPL 3(PC)
  WORD $0x1e204001		// FMOVS F0, F1
  WORD $0xbd000020		// FMOVS F0, (R1)
  WORD $0xeb05009f		// CMP R5, R4
  WORD $0x54fffee1		// BNE -9(PC)
  WORD $0x531e7463		// LSLW $2, R3, R3
  WORD $0x93407c63		// SXTW R3, R3
  WORD $0xeb03005f		// CMP R3, R2
  WORD $0x54000169		// BLS 11(PC)
  WORD $0x8b030803		// ADD R3<<2, R0, R3
  WORD $0x8b020800		// ADD R2<<2, R0, R0
  WORD $0xbd400060		// FMOVS (R3), F0
  WORD $0x91001063		// ADD $4, R3, R3
  WORD $0x1e212010		// FCMPES F1, F0
  WORD $0x5400006d		// BLE 3(PC)
  WORD $0x1e204001		// FMOVS F0, F1
  WORD $0xbd000020		// FMOVS F0, (R1)
  WORD $0xeb00007f		// CMP R0, R3
  WORD $0x54ffff21		// BNE -7(PC)
  WORD $0xd65f03c0		// RET

TEXT ·_hmin_int32(SB), $0-32

	MOVD input+0(FP),   R0
	MOVD result+8(FP),  R1
	MOVD size+16(FP),   R2

  WORD $0xbd400001		// FMOVS (R0), F1
  WORD $0xd342fc43		// LSR $2, R2, R3
  WORD $0x7100007f		// CMPW $0, R3
  WORD $0xbd000021		// FMOVS F1, (R1)
  WORD $0x5400020d		// BLE 16(PC)
  WORD $0x51000465		// SUBW $1, R3, R5
  WORD $0x91004007		// ADD $16, R0, R7
  WORD $0x2a0503e6		// MOVW R5, R6
  WORD $0xaa0003e4		// MOVD R0, R4
  WORD $0x8b2650e5		// ADD R6.UXTW<<4, R7, R5
  WORD $0x3dc00080		// MOVD (R4), V0
  WORD $0x91004084		// ADD $16, R4, R4
  WORD $0xbd400021		// FMOVS (R1), F1
  WORD $0x6eb0f800		// FMINV V0.S4, F0
  WORD $0x1e202030		// FCMPES F0, F1
  WORD $0x5400006d		// BLE 3(PC)
  WORD $0x1e204001		// FMOVS F0, F1
  WORD $0xbd000020		// FMOVS F0, (R1)
  WORD $0xeb05009f		// CMP R5, R4
  WORD $0x54fffee1		// BNE -9(PC)
  WORD $0x531e7463		// LSLW $2, R3, R3
  WORD $0x93407c63		// SXTW R3, R3
  WORD $0xeb03005f		// CMP R3, R2
  WORD $0x54000169		// BLS 11(PC)
  WORD $0x8b030803		// ADD R3<<2, R0, R3
  WORD $0x8b020800		// ADD R2<<2, R0, R0
  WORD $0xbd400060		// FMOVS (R3), F0
  WORD $0x91001063		// ADD $4, R3, R3
  WORD $0x1e212010		// FCMPES F1, F0
  WORD $0x54000065		// BPL 3(PC)
  WORD $0x1e204001		// FMOVS F0, F1
  WORD $0xbd000020		// FMOVS F0, (R1)
  WORD $0xeb00007f		// CMP R0, R3
  WORD $0x54ffff21		// BNE -7(PC)
  WORD $0xd65f03c0		// RET
